<template>
  <el-form ref="form">
    <el-form-item label="楼盘名称">
      <span>{{ rowData.real_estate_name }}</span>
    </el-form-item>
    <el-form-item label="选择业态">
      <el-select
        v-model="form.property_type.property_type_id"
        placeholder="请选择"
      >
        <el-option label="住宅" value="1"></el-option>
        <el-option label="写字楼" value="2"></el-option>
        <el-option label="商铺" value="3"></el-option>
      </el-select>
      <!-- <el-input v-model="form.property_type.property_type_name"></el-input> -->
    </el-form-item>
    <el-form-item label="楼盘均价">
      <el-input v-model="form.average_price" style="width: 217px"></el-input>
    </el-form-item>
    <el-form-item label="房源最低价">
      <el-input
        v-model="form.lowest_listing_price"
        style="width: 217px"
      ></el-input>
    </el-form-item>
    <el-form-item label="价格描述">
      <el-input type="textarea" v-model="form.price_description"></el-input>
    </el-form-item>
    <el-form-item label="价格变动">
      <el-col :span="4">
        <el-date-picker
          type="date"
          placeholder="选择日期"
          v-model="form.price_change_date"
          style="width: 100%"
        ></el-date-picker>
      </el-col>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitBtn">提交</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: ["rowData"],
  data() {
    return {
      // 楼盘id
      floorId: this.rowData.real_estate_id,
      // 业态id
      property_type_id: this.rowData.property_type_id,
      form: {
        // 房源均价
        average_price: "",
        // 最低房源价
        lowest_listing_price: "",
        // 价格变动日期
        price_change_date: "",
        // 价格描述
        price_description: "",
        price_id: "",
        // 状态
        price_status: "等待审核",
        property_type: {
          // 业态id
          property_type_id: this.property_type_id,
          // 业态级别
          property_type_level: "",
          // 业态名称
          property_type_name: "",
          // 父物业态ID
          property_type_p_id: "",
          // 业态类型排序（正整数）
          property_type_sort: "",
          // 1正常 0删除
          status: "",
          // 楼盘ID
          real_estate_id: this.floorId,
          reason_for_not_passing: "string",
          // 1正常 0删除
          status: "",
        },
      },
      floorTables: [],
    };
  },
  methods: {
    submitBtn() {
      console.log(this.floorId);
      this.axios({
        url: "http://106.14.244.89/rema/addPrice",
        method: "post",
        data: {
          average_price: this.form.average_price,
          lowest_listing_price: this.form.lowest_listing_price,
          price: {
            average_price: this.form.average_price,
            lowest_listing_price: this.form.lowest_listing_price,
            price_change_date: this.form.price_change_date,
            price_description: this.form.price_description,
            price_id: 0,
            price_status: "string",
            property_type: {
              property_type_id: this.form.property_type.property_type_id,
              property_type_level: 0,
              property_type_name: this.form.property_type.property_type_name,
              property_type_p_id: 0,
              property_type_sort: 0,
              status: 0,
            },
            property_type_id: this.form.property_type.property_type_id,
            real_estate_id: this.floorId,
            reason_for_not_passing: "string",
            status: 0,
          },
          price_change_date: this.form.price_change_date,
          price_description: this.form.price_description,
          property_type_id: this.form.property_type.property_type_id,
          real_estate_id: this.floorId,
        },
      })
        .then((data) => {
          let floorBulidingData = data;
          console.log(data);
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
  created() {
    console.log(this.rowData.real_estate_id);
  },
};
</script>

<style>
</style>